package com.zhaoxi.project.hrp.controller;

import com.zhaoxi.framework.web.BaseService;
import com.zhaoxi.framework.web.PageData;
import com.zhaoxi.framework.web.page.TableDataInfo;
import com.zhaoxi.project.hrp.domain.HrpPartner;
import com.zhaoxi.project.hrp.service.impl.HrpPartnerServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 客户跟踪Controller
 *
 * @author zhaoxi
 * @date 2023-07-07
 */
@RestController
@RequestMapping("/api/hrp")
public class HrpApiController extends BaseService {
    /**
     * crm_lead 和mdPartner都是一个类，主键相同。都是基于partner
     */
    @Autowired
    private HrpPartnerServiceImpl mdPartnerService;

    /**
     * 查询客户跟踪列表
     */
    @PreAuthorize("@ss.hasPermi('hrp:partner:list')")
    @GetMapping("/list")
    public TableDataInfo list(HrpPartner hrpPartner) {
        startPage();
        List<HrpPartner> list = mdPartnerService.selectHrpLeadList(hrpPartner);
        return getDataTable(list);
    }

    /**
     * 获取客户跟踪详细信息
     */
    @PreAuthorize("@ss.hasPermi('hrp:partner:query')")
    @GetMapping(value = "/{id}")
    public PageData getInfo(@PathVariable("id") Long id) {
        return success(mdPartnerService.selectHrpLeadById(id));
    }

}
